package com.mtnz.njk.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
 * 拦截器配置
 * 将自定义的拦截器注入到 配置中
 * @author onegis
 *
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer  {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截所有请求，判断是否有@TokenNote注解，决定是否需要验证
        registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/*/*");

    }
    @Bean
    public AuthenticationInterceptor authenticationInterceptor(){
        return new AuthenticationInterceptor();
    }

}

